<template>
  <header class="wrapper">
    <el-row>
      <el-col :span="4">
        <div class="logo">慕年</div>
      </el-col>
      <el-col :span="20">
        <el-menu
          class="nav"
          background-color="#2d2d2d"
          text-color="#9d9d9d"
          active-text-color="#fff"
          mode="horizontal"
          :default-active="activeIndex"
          @select="hanleTitle"
        >
          <el-menu-item index="1" key="">
            <router-link to="/"
              ><img
                class="icon_home"
                src="../assets/font/home.png"
              />首页</router-link
            >
          </el-menu-item>
          <el-menu-item index="2" key="">
            <router-link to="/"> 我的博客</router-link>
          </el-menu-item>
          <el-menu-item index="3" key="">
            <router-link class="signBtn" to="/">登陆</router-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
  </header>
</template>

<script>
export default {
  data() {
    return {
      activeIndex: "1",
    };
  },
  methods: {
    hanleTitle(index) {
      this.activeIndex = index;
    },
  },
};
</script>

<style lang="scss" scoped>
header {
  background: #2d2d2d;
  color: #9d9d9d;
  box-shadow: 0 2px 4px 1px rgba(0, 0, 0, 0.5);
  margin-bottom: 20px;
  .logo {
    line-height: 60px;
    font-size: 18px;
  }
  .nav {
    float: right;
    border-bottom: none;
  }
  li {
    padding: 0;
    a {
      display: inline-block;
      padding: 0 20px;
      .icon_home {
        height: 15px;
        width: 15px;
        vertical-align: top;
        margin: 22px 5px 0 0;
      }
    }
  }
}
.signBtn {
  background-color: #3b99fc !important;
  color: #fff !important;
  line-height: 60px;
}
</style>
